//    Copyright (C) Kherty.  All rights reserved.

using OpenLS.Core;
using OpenLS.Core.Serialization;

namespace OpenLS.Spreadsheet
{
    public class ChartsheetPageSetup: IOfficeXmlSerializable
    {
        internal const string xmlName = "pageSetup";
        #region IOfficeXmlSerializable Members

        public void ReadXml(ReadContext context)
        {
            using (ReadContext c = context.Read(xmlName))
            {
                PaperSize = c.GetOptionalUIntegerAsInteger("paperSize", 1);
                FirstPageNumber = c.GetOptionalUIntegerAsInteger("firstPageNumber", 1);
                Orientation = c.GetOptionalEnum("orientation", Orientation.Default);
                UsePrinterDefaults = c.GetOptionalBoolean("usePrinterDefaults", true);
                BlackAndWhite = c.GetOptionalBoolean("blackAndWhite", false);
                Draft = c.GetOptionalBoolean("draft", false);
                UseFirstPageNumber = c.GetOptionalBoolean("useFirstPageNumber", false);
                HorizontalDpi = c.GetOptionalUIntegerAsInteger("horizontalDpi", 600);
                VerticalDpi = c.GetOptionalUIntegerAsInteger("verticalDpi", 600);
                Copies = c.GetOptionalUIntegerAsInteger("copies", 1);
                //\\missing r:id
            }
        }

        public void WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write(xmlName))
            {
                c.SetOptionalUIntegerAsInteger("paperSize", PaperSize, 1);
                c.SetOptionalUIntegerAsInteger("firstPageNumber", FirstPageNumber, 1);
                c.SetOptionalEnum("orientation", Orientation, Orientation.Default);
                c.SetOptionalBoolean("usePrinterDefaults", UsePrinterDefaults, true);
                c.SetOptionalBoolean("blackAndWhite", BlackAndWhite, false);
                c.SetOptionalBoolean("draft", Draft, false);
                c.SetOptionalBoolean("useFirstPageNumber", UseFirstPageNumber, false);
                c.SetOptionalUIntegerAsInteger("horizontalDpi", HorizontalDpi, 600);
                c.SetOptionalUIntegerAsInteger("verticalDpi", VerticalDpi, 600);
                c.SetOptionalUIntegerAsInteger("copies", Copies, 1);
                //\\missing r:id
            }
        }

        #endregion
        private int _paperSize = 1;

        public int PaperSize
        {
            get { return _paperSize ; }
            set { _paperSize = value; }
        }
        private int _firstPageNumber;

        public int FirstPageNumber
        {
            get { return _firstPageNumber; }
            set { _firstPageNumber = value; }
        }
        private Orientation _orientation;

        public Core.Orientation Orientation
        {
            get { return _orientation; }
            set { _orientation = value; }
        }
        private bool _usePrinterDefaults = true;

        public bool UsePrinterDefaults
        {
            get { return _usePrinterDefaults; }
            set { _usePrinterDefaults = value; }
        }
        private bool _blackAndWhite;

        public bool BlackAndWhite
        {
            get { return _blackAndWhite; }
            set { _blackAndWhite = value; }
        }
        private bool _draft;

        public bool Draft
        {
            get { return _draft; }
            set { _draft = value; }
        }
        private bool _useFirstPageNumber;

        public bool UseFirstPageNumber
        {
            get { return _useFirstPageNumber; }
            set { _useFirstPageNumber = value; }
        }
        private int _horizontalDpi = 600;

        public int HorizontalDpi
        {
            get { return _horizontalDpi; }
            set { _horizontalDpi = value; }
        }
        private int _verticalDpi = 600;

        public int VerticalDpi
        {
            get { return _verticalDpi; }
            set { _verticalDpi = value; }
        }
        private int _copies = 1;

        public int Copies
        {
            get { return _copies; }
            set { _copies = value; }
        }
	
	
	
	
	
	
	
	
    }
}
